package serveur;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

import surname.protocol.AbstractRequest;

public class Reception {
	private Socket socket;
	private ObjectInputStream is;

	public Reception(Socket s) {
		socket = s;
		try 
		{
			is = new ObjectInputStream(socket.getInputStream());
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		}
	}

	public AbstractRequest get() {
		
		try 
		{
			return (AbstractRequest) is.readObject();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
		} 
		catch (ClassNotFoundException e) 
		{
			e.printStackTrace();
		}
		return null;
	}
}
